/*
 */
package org.hook.showcase.persistence.mybatis;

import org.hook.showcase.persistence.mybatis.model.Product;
import org.hook.showcase.persistence.mybatis.service.ProductService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.util.Assert;

/**
 * @author suwuqiang 2011-7-14
 */
public class MyBatisDemo02 {

	public static void main(String[] args) {
		ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:mybatis/application.xml");
		Assert.notNull(ctx, "Load ApplicationContext Fail.");
		ProductService productService = ctx.getBean(ProductService.class);
		Assert.notNull(productService, "ProductService is Null.");
		String productId = "FI-SW-01";
		Product product = productService.getProduct(DataSourceConstants.DATA_SOUCE_TARGET_DEFAULT, productId);
		Assert.notNull(product, "Product is Null.");
		System.out.println(product);
	}
}
